<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
	<div class="wrapper wrapper-content animated fadeInRight">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox-content">
					<form class="form-horizontal m-t" id="signupForm">
						<input id="id" name="id" th:value="${wx.id}"
							type="hidden">
							<!-- <input id="sfzy" name="sfzy" th:value="${wx.sfzy}"
							type="hidden"> -->
						<!-- <div class="form-group">
							<label class="col-sm-3 control-label">是否有自己账户：</label>
							<div class="col-sm-8">
								<select id="selectTest" name="selectTest" onchange="gradeChange()">
										<option value="0">否</option>
										<option value=1>是</option>
								</select>
							</div>
						</div> -->
						<div class="form-group">
							<label class="col-sm-3 control-label">小程序名称：</label>
							<div class="col-sm-8">
								<input id="title" name="title" class="form-control" type="text"
									th:value="${wx.title}">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">Appid：</label>
							<div class="col-sm-8">
								<input id="appid" name="appid" class="form-control"
									type="text" th:value="${wx.appid}" >
							</div>
							
							
							<label class="col-sm-3 control-label">Appsecret：</label>
							<div class="col-sm-8">
								<input id="appsecret" name="appsecret" class="form-control"
									type="text" th:value="${wx.appsecret}" >
							</div>
							<!-- <div class="form-group">
							<label class="col-sm-3 control-label">关联用户</label>
							<input id="adminId" name="adminId" th:value="${wx.adminId}"class="form-control"
									type="hidden"  >
					                   <button type="button" id="addUser2" onclick="addUser()" class="btn btn-primary fachoose" data-input-id="c-smallimage" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> 选择用户</button>
							</div> -->
						<!-- <div class="form-group">
							<label class="col-sm-3 control-label">用户id</label>
							<span id="userName" th:text="${wx.adminId}"></span>
						</div> -->
							<label class="col-sm-3 control-label">美团代理key：</label>
							<div class="col-sm-8">
								<input id="proxykey" name="proxykey" class="form-control"
									type="text" th:value="${wx.proxykey}" >
							</div>
							
							
							<label class="col-sm-3 control-label">美团代理secret：</label>
							<div class="col-sm-8">
								<input id="proxysecret" name="proxysecret" class="form-control"
									type="text" th:value="${wx.proxysecret}" >
							</div>
							
							
							<label class="col-sm-3 control-label">美团回调secret：</label>
							<div class="col-sm-8">
								<input id="callbacksecret" name="callbacksecret" class="form-control"
									type="text" th:value="${wx.callbacksecret}" >
							</div>
							
							
							<label class="col-sm-3 control-label">客服二维码：</label>
							<div class="col-sm-8">
								<input id="smallimage" name="smallimage" class="form-control"
									type="hidden" th:value="${wx.smallimage}" >
									<div class="col-sm-11" id="newsImg">
                                			<img th:src="${wx.smallimage}" height='100' width='100'>
									</div> 
									
									<button type="button" id="test1" class="btn btn-danger faupload dz-clickable" data-input-id="c-smallimage" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-smallimage" initialized="true"><i class="fa fa-upload dz-message"></i> 上传</button>
									
							</div>
							
							<label class="col-sm-3 control-label">饿了么外卖链接：</label>
							<div class="col-sm-8">
									<input id="elemawaimai" name="elemawaimai" th:value="${wx.elemawaimai}" class="form-control"
									type="text"  >
									
							</div>
							
							<label class="col-sm-3 control-label">饿了么商超链接：</label>
							<div class="col-sm-8">
 									<input id="elemashangchao" name="elemashangchao" th:value="${wx.elemashangchao}" class="form-control"
									type="text"  >
							</div>
							
							<label class="col-sm-3 control-label">饿了么大额红包链接：</label>
							<div class="col-sm-8">
									<input id="elemahongbao" name="elemahongbao" th:value="${wx.elemahongbao}" class="form-control"
									type="text"  >
									
							</div>
							
							<!-- <label class="col-sm-3 control-label">美团外卖二维码：</label>
							<div class="col-sm-8">
								<input id="mtwm" name="mtwm" class="form-control"
									type="hidden" th:value="${wx.mtwm}" >
									<div class="col-sm-11" id="newsImg4">
                                			<img th:src="${wx.mtwm}" height='100' width='100'>
									</div> 
 									<button type="button" id="test4" class="btn btn-danger faupload dz-clickable" data-input-id="c-smallimage" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-smallimage" initialized="true"><i class="fa fa-upload dz-message"></i> 上传</button>
							</div>
							
							<label class="col-sm-3 control-label">美团商超二维码：</label>
							<div class="col-sm-8">
								<input id="mtsc" name="mtsc" class="form-control"
									type="hidden" th:value="${wx.mtsc}" >
									<div class="col-sm-11" id="newsImg5">
                                			<img th:src="${wx.mtsc}" height='100' width='100'>
									</div> 
 									<button type="button" id="test5" class="btn btn-danger faupload dz-clickable" data-input-id="c-smallimage" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-smallimage" initialized="true"><i class="fa fa-upload dz-message"></i> 上传</button>
							</div>
							
							<label class="col-sm-3 control-label">logo：</label>
							<div class="col-sm-8">
								<input id="applog" name="applog" class="form-control"
									type="hidden" th:value="${wx.applog}" >
									<div class="col-sm-11" id="newsImg6">
                                			<img th:src="${wx.applog}" height='100' width='100'>
									</div> 
 									<button type="button" id="test6" class="btn btn-danger faupload dz-clickable" data-input-id="c-smallimage" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-smallimage" initialized="true"><i class="fa fa-upload dz-message"></i> 上传</button>
							</div> -->
							
							<label class="col-sm-3 control-label">token：</label>
							<div class="col-sm-8">
								<input id="token" name="token" class="form-control"
									type="text" th:value="${wx.token}" >
							</div>
							
							
							<label class="col-sm-3 control-label">上二级佣金：</label>
							<div class="col-sm-8">
								<input id="levelone" name="levelone" class="form-control"
									type="text" th:value="${wx.levelone}" >
							</div>
							
							<label class="col-sm-3 control-label">上一级佣金：</label>
							<div class="col-sm-8">
								<input id="leveltwo" name="leveltwo" class="form-control"
									type="text" th:value="${wx.leveltwo}" >
							</div>
							<label class="col-sm-3 control-label">标准佣金：</label>
							<div class="col-sm-8">
								<input id="levelthree" name="levelthree" class="form-control"
									type="text" th:value="${wx.levelthree}" >
							</div>
							<!-- <label class="col-sm-3 control-label">会员卡产品加价(%)：</label>
							<div class="col-sm-8">
								<input id="smoney" name="smoney" class="form-control"
									type="text" th:value="${wx.smoney}" >
							</div>
							
							<label class="col-sm-3 control-label">会员卡佣金：</label>
							<div class="col-sm-8">
								<input id="commission" name="commission" class="form-control"
									type="text" th:value="${wx.commission}" >
							</div> -->
							
							
							<label class="col-sm-3 control-label">[模板消息]新加入：</label>
							<div class="col-sm-8">
								<input id="serviceTemplate" name="serviceTemplate" class="form-control"
									type="text" th:value="${wx.serviceTemplate}" >
							</div>
							
							<label class="col-sm-3 control-label">[模板消息]新订单：</label>
							<div class="col-sm-8">
								<input id="serviceTemplate1" name="serviceTemplate1" class="form-control"
									type="text" th:value="${wx.serviceTemplate1}" >
							</div>
							
							<label class="col-sm-3 control-label">[模板消息]确认收货：</label>
							<div class="col-sm-8">
								<input id="serviceTemplate2" name="serviceTemplate2" class="form-control"
									type="text" th:value="${wx.serviceTemplate2}" >
							</div>
							
							
							<label class="col-sm-3 control-label">[模板消息]余额变动：</label>
							<div class="col-sm-8">
								<input id="serviceTemplate3" name="serviceTemplate3" class="form-control"
									type="text" th:value="${wx.serviceTemplate3}" >
							</div>
							<label class="col-sm-3 control-label">[模板消息]砍价成功：</label>
							<div class="col-sm-8">
								<input id="serviceTemplate4" name="serviceTemplate4" class="form-control"
									type="text" th:value="${wx.serviceTemplate4}" >
							</div>
							
						</div>
						<div class="text-right form-group">
								<a class="btn btn-default waves-effect waves-light"
									onclick="returnList()">返回列表</a>
								<button type="button"
									class="btn btn-primary waves-effect waves-light"
									onclick="save()">保存</button>
							</div>
					</form>
				</div>
			</div>
		</div>
	</div>
	<div th:include="include::footer"></div>
	<script type="text/javascript" src="/js/appjs/config/wxEdit.js">
	</script>
	<script src="/js/layui.js"></script>
	<script src="/js/plugins/layer/layer.min.js"></script>
	<script type="text/javascript">
	 $(function() {
		 $(".layui-upload-file").hide();
		 var sfzy=$('#sfzy').val();
			$("#selectTest option[value= "+sfzy+"]").attr("selected", "selected");
	 })
	 
	 function gradeChange() {
		 var cc = $("#selectTest").val();
		 $("#sfzy").val(cc);
	}
     layui.use('upload', function () {
        var upload = layui.upload;
        //执行实例
        var uploadInst = upload.render({
            elem: '#test1', //绑定元素
            url: '/common/sysFile/upload', //上传接口
            size: 1000,
            accept: 'file',
            done: function (r) {
                layer.msg(r.msg);
                $("#smallimage").val("");
                $("#smallimage").val(r.fileName);
                $("#newsImg").html("");
	            $("#newsImg").append(" <img src='"+r.fileName+"' alt='...' height='100' width='100'>" );
            },
            error: function (r) {
                layer.msg(r.msg);
            }
        });
    });
	 layui.use('upload', function () {
	        var upload = layui.upload;
	        //执行实例
	        var uploadInst = upload.render({
	            elem: '#test2', //绑定元素
	            url: '/common/sysFile/upload', //上传接口
	            size: 1000,
	            accept: 'file',
	            done: function (r) {
	                layer.msg(r.msg);
	                $("#elemawaimai").val("");
	                $("#elemawaimai").val(r.fileName);
	                $("#newsImg2").html("");
		            $("#newsImg2").append(" <img src='"+r.fileName+"' alt='...' height='100' width='100'>" );
	            },
	            error: function (r) {
	                layer.msg(r.msg);
	            }
	        });
	    });
	 layui.use('upload', function () {
	        var upload = layui.upload;
	        //执行实例
	        var uploadInst = upload.render({
	            elem: '#test3', //绑定元素
	            url: '/common/sysFile/upload', //上传接口
	            size: 1000,
	            accept: 'file',
	            done: function (r) {
	                layer.msg(r.msg);
	                $("#elemashangchao").val("");
	                $("#elemashangchao").val(r.fileName);
	                $("#newsImg3").html("");
		            $("#newsImg3").append(" <img src='"+r.fileName+"' alt='...' height='100' width='100'>" );
	            },
	            error: function (r) {
	                layer.msg(r.msg);
	            }
	        });
	    }); 
	 layui.use('upload', function () {
	        var upload = layui.upload;
	        //执行实例
	        var uploadInst = upload.render({
	            elem: '#test4', //绑定元素
	            url: '/common/sysFile/upload', //上传接口
	            size: 1000,
	            accept: 'file',
	            done: function (r) {
	                layer.msg(r.msg);
	                $("#mtwm").val("");
	                $("#mtwm").val(r.fileName);
	                $("#newsImg4").html("");
		            $("#newsImg4").append(" <img src='"+r.fileName+"' alt='...' height='100' width='100'>" );
	            },
	            error: function (r) {
	                layer.msg(r.msg);
	            }
	        });
	    }); 
	 layui.use('upload', function () {
	        var upload = layui.upload;
	        //执行实例
	        var uploadInst = upload.render({
	            elem: '#test5', //绑定元素
	            url: '/common/sysFile/upload', //上传接口
	            size: 1000,
	            accept: 'file',
	            done: function (r) {
	                layer.msg(r.msg);
	                $("#mtsc").val("");
	                $("#mtsc").val(r.fileName);
	                $("#newsImg5").html("");
		            $("#newsImg5").append(" <img src='"+r.fileName+"' alt='...' height='100' width='100'>" );
	            },
	            error: function (r) {
	                layer.msg(r.msg);
	            }
	        });
	    }); 
	 layui.use('upload', function () {
	        var upload = layui.upload;
	        //执行实例
	        var uploadInst = upload.render({
	            elem: '#test6', //绑定元素
	            url: '/common/sysFile/upload', //上传接口
	            size: 1000,
	            accept: 'file',
	            done: function (r) {
	                layer.msg(r.msg);
	                $("#applog").val("");
	                $("#applog").val(r.fileName);
	                $("#newsImg6").html("");
		            $("#newsImg6").append(" <img src='"+r.fileName+"' alt='...' height='100' width='100'>" );
	            },
	            error: function (r) {
	                layer.msg(r.msg);
	            }
	        });
	    }); 
    /* function setUrl(url) {
    	$("#smallimage").val("");
        $("#smallimage").val(url);
    	$("#newsImg").html("");
        $("#newsImg").append(" <img src='"+url+"' alt='...' height='100' width='100'>" );
    }
    
    function setUrl2(url) {
    	$("#elemawaimai").val("");
        $("#elemawaimai").val(url);
    	$("#newsImg2").html("");
        $("#newsImg2").append(" <img src='"+url+"' alt='...' height='100' width='100'>" );
    }
    
    function setUrl3(url) {
    	$("#elemashangchao").val("");
        $("#elemashangchao").val(url);
    	$("#newsImg3").html("");
        $("#newsImg3").append(" <img src='"+url+"' alt='...' height='100' width='100'>" );
    } 
    
    function setUrl4(url) {
    	$("#mtwm").val("");
        $("#mtwm").val(url);
    	$("#newsImg4").html("");
        $("#newsImg4").append(" <img src='"+url+"' alt='...' height='100' width='100'>" );
    }
    
    function setUrl5(url) {
    	$("#mtsc").val("");
        $("#mtsc").val(url);
    	$("#newsImg5").html("");
        $("#newsImg5").append(" <img src='"+url+"' alt='...' height='100' width='100'>" );
    }
    
    function setUrl6(url) {
    	$("#applog").val("");
        $("#applog").val(url);
    	$("#newsImg6").html("");
        $("#newsImg6").append(" <img src='"+url+"' alt='...' height='100' width='100'>" );
    }*/
    function addFile(type) {
    	parent.layer.open({
    		type : 2,
    		title : '编辑',
    		maxmin : true,
    		shadeClose : false, // 点击遮罩关闭层
    		area : [ '900px', '650px' ],
    		content : '/common/sysFile/addFile/' +type// iframe的url
    	});
    }
    
    function addUser() {
    	parent.layer.open({
    		type : 2,
    		title : '编辑',
    		maxmin : true,
    		shadeClose : false, // 点击遮罩关闭层
    		area : [ '900px', '650px' ],
    		content : '/config/user' // iframe的url
    	});
    }
    
    function setUserId(url,userName) {
    	$("#adminId").val("");
        $("#adminId").val(url);
        $("#userName").html("");
        $("#userName").html(url);
    }
</script>
	
</body>
</html>
